<?php

class AdminController extends AppController
{
	
	/**
	 * Declares class-based actions.
	 */
	public function actions()
	{
		
	}
	
	/**
	 * This is the default 'index' action that is invoked
	 * when an action is not explicitly requested by users.
	 */
	public function actionIndex()
	{
		require('routeros_api.class.php');
	
		$API = new routeros_api();
		/*
		$API->write('/system/clock/getall');
		$API->write('/system/resource/getall');
		$API->write('/system/resource/irq/getall');
		$API->write('/system/resource/pci/getall');
		*/
	//	$API->debug = true;
		
		if ($API->connect('192.168.88.1', 'admin', '')) {
	
	   $API->write('/tool/user-manager/user/getall');
	 
	   $READ = $API->read(false);
	   $ARRAY = $API->parse_response($READ);
	
	  //	echo "<pre>";print_r($ARRAY);echo "</pre>";
	  	
	   $API->disconnect();
	
	}
		$this->render('index', array(
			'ARRAY'=>$ARRAY)
                      );
	}
	
	public function actionResource()
	{
	
		$this->render('resource');
		/*$this->render('CallResource', array(
		 'ARRAY'=>$ARRAY)
		);*/
	}
	
	public function actionCallResource()
	{
		$this->renderPartial('CallResource');
	}
	
	
}
